Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.
Note: For the purpose of this problem, we define empty string as valid palindrome.
Input: "A man, a plan, a canal: Panama" Output: true
Input: "race a car" Output: false
classSolution: defisPalindrome(self, s: str) ->bool: s=''.join([cforcinsifc.isalnum()]).lower() i, j=0, len(s) -1whilei<j: ifs[i] !=s[j]: returnFalsei+=1j-=1returnTrue
classSolution: defisPalindrome(self, s: str) ->bool: s=''.join([cforcinsifc.isalnum()]).lower() returns[::-1] ==s